Skip to content

[compass_app] Fix Command<T> to capture action exceptions as Result<T> - #2889

Open
s6o wants to merge 1 commit into
flutter:mainfrom
s6o:main
Open

s6o wants to merge 1 commit into
flutter:mainfrom
s6o:main

Conversation

@s6o

@s6o s6o commented Oct 9, 2026

Copy link
Copy Markdown

The Command<T> action return was not captured as Result<T> when the action throws.

  • the fix will make Command<T>'s action always return a Result<T>
  • an additional test added to the test/utils/command_test.dart to verify the fix

Pre-launch Checklist

  • I read the [Flutter Style Guide] recently, and have followed its advice.
  • I signed the [CLA].
  • I read the [Contributors Guide].
  • I have added sample code updates to the [changelog].
  • I updated/added relevant documentation (doc comments with ///).

try {
_result = await action();
} on Exception catch (e) {
_result = Result<T>.error(e);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Howdy @s6o.

I'm not sure this is actually desired... The consumer of this class might want to catch the error, and this would prevent that.

It's been a long time since I've looked at the full app code, so I'm open to being wrong here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants